package io.renren.modules.eightapp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.ConvertUtils;
import io.renren.modules.eightapp.dao.EiManagerInfoDao;
import io.renren.modules.eightapp.dto.EiManagerInfoDTO;
import io.renren.modules.eightapp.entity.EiManagerInfoEntity;
import io.renren.modules.eightapp.service.EiManagerInfoService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 
 *
 * @author Mark 1132115960@gmail.com
 * @since 1.0.0 2022-12-27
 */
@Service
public class EiManagerInfoServiceImpl extends CrudServiceImpl<EiManagerInfoDao, EiManagerInfoEntity, EiManagerInfoDTO> implements EiManagerInfoService {


    @Autowired
    EiManagerInfoDao eiManagerInfoDao;

    @Override
    public List<EiManagerInfoDTO> getManagerList() {
        QueryWrapper<EiManagerInfoEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().select();
        List<EiManagerInfoEntity> eiManagerInfoEntities = eiManagerInfoDao.selectList(queryWrapper);
        List<EiManagerInfoDTO> list = ConvertUtils.sourceToTarget(eiManagerInfoEntities, EiManagerInfoDTO.class);
        return list;
    }

    @Override
    public QueryWrapper<EiManagerInfoEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<EiManagerInfoEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);

        return wrapper;
    }


}